<!-- 修改昵称 -->
<template>
	<view>
		<u-navbar title="修改昵称" autoBack placeholder>
			<view slot="right">
				<view class="text-white saveStyle font-24" @click="changeUserName">保存</view>
			</view>
		</u-navbar>
		<view class="mt-1 flex justify-center px-2" style="background-color: #fff; height: 100rpx;">
			 <u-input placeholder="请输入昵称" v-model="nickName" border="none" clearable suffix-icon-style="color: #55565a;"></u-input>
		</view>
	</view>
</template>

<script>
	// 1500000000010
	export default {
		data() {
			return {
				nickName: ''
			}
		},
		onLoad(e) {
			this.nickName = e.nickname
		},
		methods: {
			changeUserName(){
				this.$api.myprofile({
					nickname:this.nickName
				}).then(res=>{
					if(res.code === 1){
						uni.showToast({
							title: '设置成功',
							icon:'none'
						});
						uni.navigateBack()
					}
				})
			}
		}
	}
</script>

<style scoped>
	.saveStyle {
		width: 100rpx;
		line-height: 50rpx;
		text-align: center;
		background-color: #6ed06f;
		border-radius: 16rpx;
	}
</style>